<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="../../../common/taglibs.jsp" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<s:if test="@org.springside.modules.security.springsecurity.SpringSecurityUtils@getCurrentUserName() == 'anonymousUser'">
		<s:include value="/admin/login.jsp" />
</s:if> <s:else>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>静态信息编辑</title>
<style type="text/css">
/*contact************************************/
.contect .manage_massage{
  margin:15px;
  border: 1px solid #ccc;
}
.contect .manage_massage .manage_classify{
  position: relative;
  margin: 0 185px;
  padding-top: 30px;
}
.contect .manage_massage label{
  position: absolute;
  left: -135px;
  float: left;
  display: inline-block;
  width: 120px;
  line-height: 27px;
  text-align: right;
  font-size: 16px;
  margin-right: 5px;
}
.contect .manage_massage .add_file{
  display: inline-block;
  width: 84px;
  height: 35px;background: url(${ctx }/images/body_button_handup_p.png) no-repeat;
}
.contect .manage_massage .add_file:hover{
  background: url(${ctx }/images/body_button_hangup_active.png) no-repeat;
}
.contect .manage_massage .textarea{
  width: 100%;
  height:369px;
  padding: 10px;
}
.contect .manage_massage .add_file_textarea{
  float: right;
  margin:14px 0 33px;
}

.contect .contact_textarea{
  width: 100%;
  height: 497px;
  padding: 10px; 
}
</style>
<link href="${ctx }/css/public.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="${ctx }/kindeditor-4.1.9/themes/simple/simple.css" />
<script charset="utf-8" src="${ctx }/kindeditor-4.1.9/kindeditor-min.js"></script>
<script charset="utf-8" src="${ctx }/kindeditor-4.1.9/lang/zh_CN.js"></script>

<script>
	var editor;
	KindEditor.ready(function(K) {
		editor = K.create('textarea[name="entity.details"]', {
			       cssPath : '${ctx}/kindeditor-4.1.9/plugins/code/prettify.css',
				uploadJson :  '${ctx}/kindeditor-4.1.9/jsp/upload_json.jsp',  
				themeType : 'simple',
				fillDescAfterUploadImage:true,
				items:   [ 'source', '|', 'undo', 'redo', '|', 'preview', 'cut', 'copy', 'paste',
        'plainpaste', 'wordpaste', '|', 'justifyleft', 'justifycenter', 'justifyright',
        'justifyfull', 'insertorderedlist', 'insertunorderedlist', 'indent', 'outdent', 'subscript',
        'superscript', 'clearhtml', 'quickformat', 'selectall', '|', 'fullscreen', '/',
        'formatblock', 'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold',
        'italic', 'underline', 'strikethrough', 'lineheight', 'removeformat', '|', 'hr', 'link', 'unlink', '|','filemanager','insertfile','image'] ,
				fileManagerJson : '${ctx}/kindeditor-4.1.9/jsp/file_manager_json.jsp',
				allowFileManager : true,
				afterCreate : function() {
					var self = this;
					K.ctrl(document, 13, function() {
						self.sync();
						document.forms['article'].submit();
					});
					K.ctrl(self.edit.doc, 13, function() {
						self.sync();
						document.forms['ar7ticle'].submit();
					});
				}
			});
		});
		</script>
</head>

<body>
	<div class="main">
		<div class="tip">
      <span>所在位置 :</span>
      <span class="current_position">编辑${category}</span>   
    </div>
    <div class="contect">
      <form action="${ctx }/admin/staticmessage-admin!save.action" method="post" >
     <!-- 上传少了id和type -->

      <!-- 上传表单内容 -->
        <div class="manage_massage">
        <input type="hidden" name="type" value="${type}"/>
        <input type="hidden" name="id" value="${id}"/>
          <div class="manage_classify clearfix">
            <label for="textarea">输入文本 :</label>
            <textarea id="textarea" class="contact_textarea"  name="entity.details">${entity.details}</textarea>
            <a class="add_file add_file_textarea"></a>
            <input type="submit" id="submit" style="display:none;" />
          </div>
        </div>
      </form>
    </div>
	</div>
	
  <script type="text/javascript" src="${ctx }/js/public.js"></script>
  
  <script type="text/javascript">
    //点击提交按钮，表单提交 这里需要一个接口上传数据
 //点击提交按钮，表单提交 这里需要一个接口上传数据

    var add_file_textarea = newdom.getElementsByClass("add_file_textarea")[0],
        submit = newdom.$("submit");
    add_file_textarea.onclick = function(){

        if(editor.isEmpty()){
			alert("正文不能为空！");
			return false;
		}
        
   
      else{
        submit.click();
      }

    }

  </script>
</body>
</html>
</s:else>